package com.codeape.number.base.mvvm.bindingadapter.View;

import android.view.View;

import androidx.databinding.BindingAdapter;

import com.codeape.number.base.mvvm.command.Command;

/**
 * View的ViewBindingAdapter
 *
 * @author LiuPeiming
 * Created at 2018/11/3 18:30
 */
public final class ViewBindingAdapter {

    /**
     * 设置View点击响应
     *
     * @param view         View
     * @param clickCommand Command
     */
    @BindingAdapter({"clickCommand"})
    public static void clickCommand(View view, final Command clickCommand) {
        view.setOnClickListener(view1 -> clickCommand.execute());
    }

}